FPS = 24.0
from OOControls.sceneParser import SceneParser,Controller,Parameter,PARM_ON_OFF,PARM_ABSOLUTE_DISTANCE,SimulationControl,BoidControl,Controls

CONTROLLERS = [Controller(name="Simulation",parm_list=[Parameter(name="Running",typ=PARM_ON_OFF)]),
               Controller(name="Boid",parm_list=[
                  Parameter(attribute="min_speed",typ=PARM_ABSOLUTE_DISTANCE,name="Min speed per second"),
                  Parameter(attribute="max_speed",typ=PARM_ABSOLUTE_DISTANCE,name="Max speed per second"),
                  Parameter(attribute="velocity",typ=PARM_ABSOLUTE_DISTANCE,name="Initial speed per second"),
                  Parameter(attribute="max_acceleration",typ=PARM_ABSOLUTE_DISTANCE,name="Max acceleration per second per second"),
                  ]) 
]

  
sp = SceneParser()
sp.build_tree()

c = CONTROLLERS
l = Controls(sp.get_controllers(cont_list=c))
s = l.get_first(control_class=SimulationControl)
print (s.carrara_object.name if s.carrara_object is not None else "None"),s.object.name,s.controller.name
for p in s.parameters:
  print "--",p.name,p.get_value(0.0)
(start,end) =  s.get_boundaries()
print start,end
for c in l.get_subset(control_class=BoidControl):
  print (c.carrara_object.name if c.carrara_object is not None else "None"),c.object.name,c.controller.name
  for p in c.parameters:
    print "--",p.name,p.get_value(start)
  c.carrara_object.refresh()
  print "position",c.carrara_object.position
  print "orientation",c.carrara_object.orientation
